/*
 * JFoenix
 * Copyright (c) 2015, JFoenix and/or its affiliates., All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 */

package com.tcoding.client.components;

import com.jfoenix.controls.JFXDatePicker;
import com.jfoenix.controls.JFXTimePicker;
import com.tcoding.client.MainDemo;
import com.tcoding.client.components.extend.JFXDateTimeCalendar;
import com.tcoding.client.components.extend.JFXDateTimePicker;
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import tornadofx.control.DateTimePicker;

public class DatePickerDemo extends Application {


    @Override
    public void start(Stage stage) {

        FlowPane main = new FlowPane();
        main.setVgap(20);
        main.setHgap(20);


        JFXDateTimePicker dateTimePicker = new JFXDateTimePicker();

        DateTimePicker picker = new DateTimePicker();

        DatePicker datePicker = new DatePicker();
        main.getChildren().add(picker);
        main.getChildren().add(datePicker);
        main.getChildren().add(dateTimePicker);
        JFXDatePicker datePickerFX = new JFXDatePicker();
        main.getChildren().add(datePickerFX);
        datePickerFX.setPromptText("pick a date");

        JFXTimePicker blueDatePicker = new JFXTimePicker();
        blueDatePicker.setDefaultColor(Color.valueOf("#3f51b5"));

        blueDatePicker.set24HourView(true);

        blueDatePicker.setOverLay(true);
        main.getChildren().add(blueDatePicker);

        datePickerFX.setOnHidden(e->{
            System.out.println("12333");
        });

        Button b = new Button("123");
        b.setOnAction(e->{
            datePickerFX.fireEvent(new Event(ActionEvent.ACTION));
        });
        main.getChildren().add(b);


        StackPane pane = new StackPane();
        pane.getChildren().add(main);
        StackPane.setMargin(main, new Insets(100));
        pane.setStyle("-fx-background-color:WHITE");

        final Scene scene = new Scene(pane, 400, 700);
        final ObservableList<String> stylesheets = scene.getStylesheets();
        stylesheets.addAll(
                           MainDemo.class.getResource("/css/jfoenix-design.css").toExternalForm());
        stage.setTitle("JFX Date Picker Demo");
        stage.setScene(scene);
        stage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }

}
